<HTML>
<HEAD>
    <TITLE>北京出租房</TITLE>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <link href="style/mycss.css" rel="stylesheet" type="text/css"/>
    <link href="style/texts.css" rel="stylesheet" type="text/css"/>
    <link href="style/btn.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
    <script lang="javascript">
        function login() {
            if (document.myForm.uname.value == "") {
                alert("用户名不能为空");
                return false;
            } else if (document.myForm.upass.value == "") {
                alert("密码不能为空");
                return false;
            } else {
                return true;
            }
        }

        $(function () {
            $("#login").click(function () {
                $.ajax({
                    url: "login",
                    type: "post",
                    data: {
                        uName: $("#uname").val(),
                        password: $("#password").val()
                    },
                    success: function (result) {
                        if (result.meta.status === 100) {
                            alert(result.meta.msg);
                            $("#uname").val("");
                            $("#password").val("");
                        } else {
                            localStorage.setItem("user", JSON.stringify(result.data));
                            location.href = "login.html";
                        }
                    },
                    dataType: "json"
                });
            });
        })
    </script>
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>

<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="5"><img src="images/top.jpg" width="780" height="170"></td>
    </tr>
    <tr>
        <td colspan="5"><img src="images/middle1.jpg" width="780" height="47"></td>
    </tr>
    <tr>
        <td width="38" background="images/middle2.jpg">&nbsp;</td>
        <td width="172">
            <table align="center">
                <tr>
                    <td><a href="index.html">返回首页</a></td>
                </tr>
                <tr>
                    <td><a href="reg.html">用户注册</a></td>
                </tr>
            </table>
        </td>
        <td width="35" background="images/layout_24.gif">&nbsp;</td>
        <td width="495">
            <form action="login.html" method="post" name="myForm" onsubmit="return login()">
                <table align="center">
                    <tr>
                        <td colspan="2" align="center">

                        </td>
                    </tr>
                    <tr>
                        <td>用户登陆：</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <hr/>
                        </td>
                    </tr>
                    <tr>
                        <td>用户名：</td>
                        <td><input type="text" id="uname" name="uname"></td>
                    </tr>
                    <tr>
                        <td>密码：</td>
                        <td><input type="password" id="password" name="upass"></td>
                    </tr>
                    <tr>
                        <td>
                            <input type="hidden" name="sign" value="login"/>
                            <input type="button" value="登陆" id="login" class="btn">
                        </td>
                    </tr>
                </table>
            </form>
        </td>
        <td width="40" background="images/middle4.jpg">&nbsp;</td>
    </tr>
    <tr>
        <td colspan="5"><img src="images/bottom.jpg" width="780" height="82"></td>
    </tr>
</table>
<P align="center">教育 版权所有</P>
<br/>
</BODY>
</HTML>